package com.zw.langchainai.controller;

import com.zw.langchainai.assistant.XiaoZhiAssistant;
import com.zw.langchainai.bean.ChatForm;
import dev.langchain4j.data.message.ChatMessageSerializer;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Tag(name = "小智医疗")
@RestController
@RequestMapping("/xiaozhi")
public class XiaoZhiController {
    @Resource
    private XiaoZhiAssistant xiaoZhiAssistant;

    @Operation(summary = "小智聊天")
    @PostMapping("/chat")
    public String chat(@RequestBody ChatForm chatForm) {
        log.info("小智聊天#入参:{}", chatForm);
        return xiaoZhiAssistant.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }

}
